package com.briup.app01.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.briup.app01.bean.Article;

public interface ArticleDao {

	// 查询所有
	@Select("select * from cms_article")
	List<Article> selectAll();

	// 查询单个
	@Select("select * from cms_article where id=#{id}")
	Article selectById(long id);

	// 删除一个
	@Delete("delete from cms_article where id=#{id}")
	void deleteById(long id);

	// 添加一个
	@Insert("insert into cms_article (id,title,content,publish_time,read_times,"
			+ "status,thump_up,cover,project_id,author_id," 
			+ "category_id,compony_id) values(#{id},#{title},#{content},#{publish_time},#{read_times},"
			+ "#{status},#{thump_up},#{cover},#{project_id},#{author_id})")
	void saveArticle(Article article);
	
	//修改一个
	@Update("update cms_article set title=#{title},content=#{content} where id=#{id}")
	void update(Article article);
	

}
